import {instance} from "./request";
const baseURL = '/scenery'

export function getScenerys(data=null) {

  return  instance.get(baseURL+ '/scenerys/1/1',data)
  //  request({
    
  // }).then(res=>console.log(res))
}

export function getScenerysByPage(currentPage=1,pageSize = 10,data={type:0,info:0}) {
  let {type,info} = data;
  

  return  instance.get( `/scenery/scenerys/${currentPage}/${pageSize}?type=${type}&info=${info}`,data)

}

export function delteSceneryPicById(id,data={}) {
  let {type,info} = data;
  

  return  instance.delete( `/scenery/deletePic/${id}`,data)

}


export function updateSceneryById(data=null) {

  return  instance.put(baseURL+ '/modifyScenery',data)
  //  request({
    
  // }).then(res=>console.log(res))
}

export function importFile(id,data=null) {

  return  instance.post(baseURL+ '/addSceneryPics/'+id,data)
  //  request({
    
  // }).then(res=>console.log(res))
}
export function deleteSceneryById(id,data=null) {

  return  instance.delete(baseURL+ '/deleteScenery/'+id,data)
  //  request({
    
  // }).then(res=>console.log(res))
}

export function addScenery(data=null) {

  return  instance.post(baseURL+ '/addScenery',data, {
    headers:{
    'Content-Type': 'application/json'
  }})
  //  request({
    
  // }).then(res=>console.log(res))
}

export function getReserveList(data=null) {
let  { currentPage, pageSize,status } = data;

  return  instance.get(baseURL+ `/reserveInfPage/${currentPage}/${pageSize}/${status}`,null)
  //  request({
    
  // }).then(res=>console.log(res))
}

export function cancelRserve(reserveId,data=null) {

  return  instance.post(baseURL+ `/scenReserveCancel/${reserveId}`,data)

}

export function updateRserve(data=null) {

  return  instance.put(baseURL+ `/updateReserve`,data,{  headers:{
    'Content-Type': 'application/json'
  }})

}

export function getCommentByPage(currentPage=1,pageSize = 10,data=null) {

  return  instance.get( `/comment/scenery/commentsByPage/${currentPage}/${pageSize}`,data)

}

export function deleteCommentById(id,data=null) {
  return  instance.delete( `/scenery/comment/${id}`,data)
}


